package com.xbq.exceleditor.ui

import android.os.Bundle
import androidx.activity.viewModels
import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.MetaDataUtils
import com.gyf.immersionbar.ktx.immersionBar
import com.xbq.exceleditor.R
import com.xbq.exceleditor.bean.viewmodel.AboutViewModel
import com.xbq.exceleditor.databinding.ActivityAboutBinding
import com.xbq.xbqsdk.XbqSdk
import com.xbq.xbqsdk.component.activity.VBActivity
import com.xbq.xbqsdk.core.ui.dev.DevInfoActivity
import com.xbq.xbqsdk.util.click.fiveClick
import com.xbq.xbqsdk.util.click.onDebouncedClick
import com.xbq.xbqsdk.util.ext.getAppName
import com.xbq.xbqsdk.util.ext.getBeianNo
import com.xbq.xbqsdk.util.ext.getKefuQQ
import dagger.hilt.android.AndroidEntryPoint

/**
 * Author: liaohaiping
 * Time: 2020-10-30
 * Description:
 */
@AndroidEntryPoint
class AboutActivity : VBActivity<ActivityAboutBinding>() {
    val viewModel:AboutViewModel by viewModels()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding.adview.init("about",this)
        immersionBar {
            fitsSystemWindows(true,R.color.bg)
            statusBarDarkFont(true)
        }
        binding.tvAppName.text = "${viewModel.appName} V${viewModel.appVersion}"
        binding.tvKefuqq.text = viewModel.kefuqq
        binding.iconApp.setImageResource(viewModel.appIcon)
        binding.btnBack.onDebouncedClick { finish() }
        binding.iconApp.fiveClick { ActivityUtils.startActivity(DevInfoActivity::class.java) }
        binding.tvKefuqq.text= "客服邮箱:${getKefuQQ()}@qq.com"
        binding.tvAppBeianNo.text = "备案号：${getBeianNo()}"
        binding.llPersonalInfo.onDebouncedClick { XbqSdk.startCollectedList(this) }
        binding.llOtherSdk.onDebouncedClick { XbqSdk.startSdkShareList(this) }
    }
}